﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.WindowsAzure;
using Dokan;
using System.IO;

namespace AzureDriveCore
{
	public class AzureRootController : AzureControllerBase
	{
		public AzureRootController(CloudStorageAccount account) : base(account) { }

		private DateTime _createdDate = DateTime.UtcNow;

		public override ControllerType Type
		{
			get { return ControllerType.Root; }
		}

		public override FileOrDirectoryResult GetFileOrDirectoryResult(string path)
		{
			if (path == "")
			{
				return new FileOrDirectoryResult
				{
					IsDirectory = true,
					FileContext = null,//RequestContext.Create(_cloudBlobClient, path),
				};
			}

			return null;
		}

		public override List<FileInformation> FindFiles(string path)
		{
			if (path == "")
			{
				var result = new List<FileInformation>();

				result.Add(new FileInformation { Attributes = FileAttributes.Directory, FileName = "Blob", CreationTime = _createdDate, LastAccessTime = _createdDate, LastWriteTime = _createdDate });
				result.Add(new FileInformation { Attributes = FileAttributes.Directory, FileName = "Queue", CreationTime = _createdDate, LastAccessTime = _createdDate, LastWriteTime = _createdDate });
				result.Add(new FileInformation { Attributes = FileAttributes.Directory, FileName = "Table", CreationTime = _createdDate, LastAccessTime = _createdDate, LastWriteTime = _createdDate });

				return result;
			}

			return null;
		}
	}
}
